<template>
	<div class="l_left">
		<div class="l_left_header">
			<img src="../../../assets/imgs/banlogo.png" alt="" class="ban_logo">
			<span>版权内容仓库</span>
		</div>
		<div class="l_left_cont">
			<div class="l_left_line"><span></span></div>
			<ul v-for="(item, index) in rightMenu" :key="index">
				<li  @click="switchMenuTab(item,index)" class="l_left_li">
					<a v-if="index === parseInt(isActiveValue)" :class="chooseColor">{{item.rightName}}</a>
					<a v-else>{{item.rightName}}</a>
				</li>
				<li class="l_left_liline"></li>
			</ul>
		</div>
	</div>
</template>

<script>
export default {
  name: "copyRight",
  //接收父组件传值
  props: ["isActive", "Menulists"],
  data() {
    return {
      //菜单默认选中状态
      isActiveValue: '',
      chooseColor: {
        addcolor: true
      },
      //菜单数据
      rightMenu: []
    };
  },
  methods: {
    //左侧菜单切换
    switchMenuTab(item, index) {
      console.log("index=" + index);
      this.isActiveValue = index;
      //切换菜单状态传给父组件
      this.$emit("changeLeftMenu", this.isActiveValue);
      this.$store.commit('SET_I',index)
    }
  },

  beforeMount: function() {
    // console.log("47")
  },
  mounted: function() {
    //获取菜单默认选中状态
    this.isActiveValue = this.$store.state.comm.ENTER;
    this.rightMenu = this.Menulists;
    
    console.log("isActiveValue11111="+this.isActiveValue)
  },
  computed: {
    Nums() {
      return this.$store.state.comm.ENTER;
    }
  },
  watch: {
    Nums(val) {
      console.log("val", val);
      if (val) {
        this.isActiveValue = val;
      }else if(val == 0){
        this.isActiveValue = 0;
      }
    },
		// 路由监听
// 		$route(){
// 			this.isActiveValue = this.$route.query.activeStatus
// 		},
		isActive(val, oldVal){
					console.log("val="+val)
					this.isActiveValue = val;
			}
  }
};
</script>


<style scoped="scoped">
@import "./leftMenu.css";
</style>